home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 9474 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.4 KB

  1. Path: fang.dsto.defence.gov.au!usenet
  2. Newsgroups: comp.lang.c++
  3. Subject: Overwriting text
  4. Message-ID: <3135456C.5C4B@dsto.defence.gov.au>
  5. From: IainJameson <Iain.Jameson@dsto.defence.gov.au>
  6. Date: Thu, 29 Feb 1996 16:49:24 +1030
  7. Organization: DSTO,Australia
  8. NNTP-Posting-Host: fang.dsto.defence.gov.au
  9. Mime-Version: 1.0
  10. Content-Type: text/plain; charset=us-ascii
  11. Content-Transfer-Encoding: 7bit
  12. X-Mailer: Mozilla 2.0 (X11; I; HP-UX A.09.01 9000/735)
  13.  
  14. Hi
  15.  
  16. I have a  small problem.
  17.  
  18. I have written a GUI in Motif & C/C++. 
  19. One component lets the user alter some parameters - stored in
  20. a parameter file, the values of which I read into the appropriate 
  21. widget - by opening a number of windows and changing things - text 
  22. and numbers.
  23.  
  24. My problem is in saving the changes.
  25.  
  26. When the user uses the "save as ..." option, I copy the old parameter
  27. file into a new file, the new file name being specified by the user.
  28. Simple enough - open the original file for reading and a temp
  29. file for writing, make sure there is enough memory then do a fread() 
  30. followed by an fwrite().
  31.  
  32. Now, how do I alter the values that have changed?
  33. I've tried a few things, but nothing seems to work.
  34. For example, searching through the new file ( remember that at this
  35. point it is simply a copy of the original ) until I find a
  36. parameter which differs from a value typed in by the user, 
  37. and then trying to overwrite the line with the altered value.
  38.  
  39. I would appreciate any suggestions.
  40.  
  41. Thanks in advance.
  42.  
  43. Iain.
  44.